package gui;

import java.util.Iterator;

import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

import logic.Presentable;
import logic.Row;

public class Presentation {
	protected RowPresentation rp;
	
	protected JPanel panel;
	public Presentation(){
		
	}
	public Presentation(RowPresentation rp) {
		this.rp = rp;
	}
	
	public JComponent vizulize (Presentable t){
		panel = new JPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		JLabel header = (JLabel) panel.add(new JLabel(t.getHeader()));
		header.setFont(header.getFont().deriveFont(16));
		for(Iterator<Row> rowIterator = t.iterator();rowIterator.hasNext();){
			panel.add(rp.visualize(rowIterator.next()));
		}
		return panel;
		
	}
}
